import * as actionTypes from './actionTypes';
import { fromJS } from 'immutable';
const defaultState = fromJS({
  // 搜索框展开/关闭
  searchOverlay: null,
  // 是否登录
  isLogin: true,
  // 热门搜索数据
  searchTags: []
});

export default (state = defaultState, action) => {
  switch(action.type) {
    case actionTypes.GET_SEARCH_TAGS:
      return state.set('searchTags', fromJS(action.tags))
    case actionTypes.OPEN_SEARCH_OVERLAY :
      return state.set('searchOverlay', 'open');
    case actionTypes.CLOSE_SEARCH_OVERLAY :
      return state.set('searchOverlay', 'close');
    default:
      return state
  }
}